package com.dongdongshop.serviec.brand;

import com.alibaba.dubbo.config.annotation.Service;
import com.dongdongshop.mapper.seller.TbItemCatMapper;
import com.dongdongshop.pojo.seller.TbItemCat;
import com.dongdongshop.service.ItemCatService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

@Component
@Service
public class ItemCatServiceImpl implements ItemCatService {
    @Resource
    private TbItemCatMapper tbItemCatMapper;

    @Override
    public Long getTypeId(Long id) {
        return tbItemCatMapper.getTypeId(id);
    }

    @Override
    public List<TbItemCat> getOne(Long parentId) {
        return tbItemCatMapper.selectByParentId(parentId);
    }

    @Override
    public TbItemCat getDataById(Long id) {
        return tbItemCatMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateItemCat(TbItemCat tbItemCat) {
        return tbItemCatMapper.updateByPrimaryKeySelective(tbItemCat);
    }

    @Override
    public TbItemCat updateById(Long id) {
        return tbItemCatMapper.selectByPrimaryKey(id);
    }

    @Override
    public void addItemCat(TbItemCat tbItemCat) {
        tbItemCatMapper.insertSelective(tbItemCat);
    }

    @Override
    public int deleteIds(Long[] ids) {
        return tbItemCatMapper.deleteIds(ids);
    }

    @Override
    public List<TbItemCat> listItemCat(Long parentId) {
        return tbItemCatMapper.listItemCat(parentId);
    }
}
